import request from '@/utils/request.js'

async function getPages(currentPage, size, type) {
    let params = {
        currentPage,
        size,
        type
    }

    try {
        let res = await request.post('/comment/pages', params)
        return res.data;
    } catch (error) {
        console.error(error);
        throw error;
    }
}

async function addComment(content, date, type) {
    let params = {
        content,
        date,
        type,
    }
    try {
        let res = await request.post('/comment/add', params)
        return res.data;
    } catch (error) {
        console.error(error);
        throw error;
    }
}

export default {
    getPages,
    addComment,
}